"use strict";

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = (app) => {
      const { router, controller } = app;
      const jwt = app.middleware.jwt({ app });
      router.get("/", controller.home.index);

      router.group({ name: "user", prefix: "/user" }, (router) => {
            let { login, register, verify, info } = controller.user;
            router.post("/register", register);
            router.post("/login", login);
            router.get("/verify", verify);
            router.get("/info", jwt, info);
      });

      // 验证码
      router.get("/captcha", controller.util.captcha);
      router.get("/sendcode", controller.util.sendEmailCode);
      router.post("/uploadfile", jwt, controller.util.uploadFile);
      router.post("/mergefile", jwt, controller.util.mergeFile);
      router.post("/checkfile", jwt, controller.util.checkFile);
      
};
